// 全屏
export function enterFullscreen() {
  const element = document.documentElement
  if (element.requestFullscreen) {
    element.requestFullscreen(); // 标准方法
  } else if (element.mozRequestFullScreen) { // 适用于 Firefox
    element.mozRequestFullScreen();
  } else if (element.webkitRequestFullscreen) { // 适用于 Chrome, Safari 和 Opera
    element.webkitRequestFullscreen();
  } else if (element.msRequestFullscreen) { // 适用于 IE/Edge
    element.msRequestFullscreen();
  }
}

// 退出全屏
export function exitFullscreen() {
  if (document.exitFullscreen) {
    document.exitFullscreen(); // 标准方法
  } else if (document.mozCancelFullScreen) { // 适用于 Firefox
    document.mozCancelFullScreen();
  } else if (document.webkitExitFullscreen) { // 适用于 Chrome, Safari 和 Opera
    document.webkitExitFullscreen();
  } else if (document.msExitFullscreen) { // 适用于 IE/Edge
    document.msExitFullscreen();
  }
}


export const getDictLabel = (val, dict, props = { label: "label", value: "value" }) => {
  const row = dict.find(m => m[props.value] == val) || {};
  return row[props.label];
}